﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xinkui.Entity.AutoGenerator;
using DataFrameworkAccess;
using Xinkui.Common;

namespace Xinkui.DataAccess.AutoGenerator {
    public partial class CommonCategoryDataAccess {
        public List<CommonCategory_Entity> ListShowRoonCategory(int companyId) {

            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CommonCategory_ListShowRoomByCompany");
                cmd.SetParameterValue("@CompanyId", companyId);
                List<CommonCategory_Entity> pageList = cmd.ExecuteEntityList<CommonCategory_Entity>();
                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<CommonCategory_Entity>(0);
        }

        public List<CommonCategory_Entity> ListAllCategory() {
            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CommonCategory_ListAll");

                List<CommonCategory_Entity> pageList = cmd.ExecuteEntityList<CommonCategory_Entity>();
                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }
            return new List<CommonCategory_Entity>(0);

        }



        public List<CommonCategory_Entity> ListCategoryByParent(int parentId) {

            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CommonCategory_ListByParent");
                cmd.SetParameterValue("@ParentId", parentId);
                List<CommonCategory_Entity> pageList = cmd.ExecuteEntityList<CommonCategory_Entity>();
                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<CommonCategory_Entity>(0);
        }
    }
}
